<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace AlibabaCloud\Client\Traits;

trait ClientTrait
{
    protected static $clients = [];
    public static function set($clientName, \AlibabaCloud\Client\Clients\Client $client)
    {
        \AlibabaCloud\Client\Filter\ClientFilter::clientName($clientName);
        self::$clients[strtolower($clientName)] = $client;
        return self::$clients[strtolower($clientName)];
    }
    public static function all()
    {
        return self::$clients;
    }
    public static function del($clientName)
    {
        \AlibabaCloud\Client\Filter\ClientFilter::clientName($clientName);
        unset(self::$clients[strtolower($clientName)]);
    }
    public static function flush()
    {
        self::$clients = [];
        self::$defaultRegionId = NULL;
    }
    public static function getGlobalClient()
    {
        return self::getDefaultClient();
    }
    public static function getDefaultClient()
    {
        return self::get(\AlibabaCloud\Client\Credentials\Providers\CredentialsProvider::getDefaultName());
    }
    public static function get($clientName)
    {
        \AlibabaCloud\Client\Filter\ClientFilter::clientName($clientName);
        if(self::has($clientName)) {
            return self::$clients[strtolower($clientName)];
        }
        throw new \AlibabaCloud\Client\Exception\ClientException("Client '" . $clientName . "' not found", \AlibabaCloud\Client\SDK::CLIENT_NOT_FOUND);
    }
    public static function has($clientName)
    {
        \AlibabaCloud\Client\Filter\ClientFilter::clientName($clientName);
        return isset(self::$clients[strtolower($clientName)]);
    }
    public static function load()
    {
        if(func_get_args() === []) {
            return (new \AlibabaCloud\Client\Credentials\Ini\IniCredential())->load();
        }
        $list = [];
        foreach (func_get_args() as $filename) {
            $list[$filename] = (new \AlibabaCloud\Client\Credentials\Ini\IniCredential($filename))->load();
        }
        return $list;
    }
    public static function client(\AlibabaCloud\Client\Credentials\CredentialsInterface $credentials, \AlibabaCloud\Client\Signature\SignatureInterface $signature)
    {
        return new \AlibabaCloud\Client\Clients\Client($credentials, $signature);
    }
    public static function accessKeyClient($accessKeyId, $accessKeySecret)
    {
        print_r(get_included_files());
        if(strpos($accessKeyId, " ") !== false) {
            throw new \AlibabaCloud\Client\Exception\ClientException("AccessKey ID format is invalid", \AlibabaCloud\Client\SDK::INVALID_ARGUMENT);
        }
        if(strpos($accessKeySecret, " ") !== false) {
            throw new \AlibabaCloud\Client\Exception\ClientException("AccessKey Secret format is invalid", \AlibabaCloud\Client\SDK::INVALID_ARGUMENT);
        }
        return new \AlibabaCloud\Client\Clients\AccessKeyClient($accessKeyId, $accessKeySecret);
    }
    public static function ramRoleArnClient($accessKeyId, $accessKeySecret, $roleArn, $roleSessionName, $policy = "")
    {
        return new \AlibabaCloud\Client\Clients\RamRoleArnClient($accessKeyId, $accessKeySecret, $roleArn, $roleSessionName, $policy);
    }
    public static function ecsRamRoleClient($roleName)
    {
        return new \AlibabaCloud\Client\Clients\EcsRamRoleClient($roleName);
    }
    public static function bearerTokenClient($bearerToken)
    {
        return new \AlibabaCloud\Client\Clients\BearerTokenClient($bearerToken);
    }
    public static function stsClient($accessKeyId, $accessKeySecret, $securityToken = "")
    {
        return new \AlibabaCloud\Client\Clients\StsClient($accessKeyId, $accessKeySecret, $securityToken);
    }
    public static function rsaKeyPairClient($publicKeyId, $privateKeyFile)
    {
        return new \AlibabaCloud\Client\Clients\RsaKeyPairClient($publicKeyId, $privateKeyFile);
    }
}

?>